package p270jp.pxv.android.viewholder;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import com.google.android.gms.measurement.internal.C2066a;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.util.List;
import java.util.Objects;
import p045be.View$OnLongClickListenerC1094n0;
import p134ei.AnalyticsScreenName;
import p134ei.PixivAnalytics;
import p140eo.C2973b;
import p159fi.FirebaseEventLogger;
import p165fo.C3114c;
import p184gi.AnalyticsParameter;
import p184gi.FirebaseAnalyticsEventName;
import p184gi.FirebaseScreenNameVia;
import p184gi.ImpListEvent;
import p216hn.DefaultConstructorMarker;
import p270jp.pxv.android.R;
import p270jp.pxv.android.event.ShowWorkMenuOnLongClickEvent;
import p270jp.pxv.android.legacy.analytics.firebase.model.ComponentVia;
import p270jp.pxv.android.legacy.event.ShowIllustDetailWithViewPagerEvent;
import p270jp.pxv.android.legacy.model.IllustItem;
import p270jp.pxv.android.legacy.model.PixivIllust;
import p270jp.pxv.android.view.ThumbnailView;
import p325m0.C4721b;
import p325m0.MutabilityOwnership;
import p350mp.Timber;
import p368ng.AbstractC5243x0;

/* compiled from: IllustItemViewHolder.kt */
/* renamed from: jp.pxv.android.viewholder.IllustItemViewHolder */
/* loaded from: classes2.dex */
public final class IllustItemViewHolder extends BaseViewHolder {
    private final FirebaseEventLogger firebaseEventLogger;
    private final ThumbnailView illustGridThumbnailView;
    private final PixivAnalytics pixivAnalytics;
    public static final Companion Companion = new Companion(null);
    public static final int $stable = 8;

    /* compiled from: IllustItemViewHolder.kt */
    /* renamed from: jp.pxv.android.viewholder.IllustItemViewHolder$Companion */
    /* loaded from: classes2.dex */
    public static final class Companion {
        private Companion() {
        }

        public /* synthetic */ Companion(DefaultConstructorMarker eVar) {
            this();
        }

        public static /* synthetic */ void getLayoutRes$annotations() {
        }

        public final int getLayoutRes() {
            return R.layout.view_illust_item;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public IllustItemViewHolder(View view) {
        super(view);
        MutabilityOwnership.m3745m(view, "itemView");
        View findViewById = view.findViewById(R.id.illust_grid_thumbnail_view);
        MutabilityOwnership.m3746l(findViewById, "itemView.findViewById(R.…lust_grid_thumbnail_view)");
        this.illustGridThumbnailView = (ThumbnailView) findViewById;
        Context context = view.getContext();
        MutabilityOwnership.m3746l(context, "itemView.context");
        AbstractC5243x0 x0Var = (AbstractC5243x0) C2973b.m6512b(context, AbstractC5243x0.class);
        this.firebaseEventLogger = x0Var.mo3364d();
        this.pixivAnalytics = x0Var.mo3365R();
    }

    /* renamed from: bind$lambda-0 */
    public static final void m12320bind$lambda0(FirebaseScreenNameVia kVar, IllustItemViewHolder illustItemViewHolder, PixivIllust pixivIllust, Object obj, ComponentVia componentVia, View view) {
        AnalyticsScreenName cVar;
        FirebaseAnalyticsEventName jVar = FirebaseAnalyticsEventName.CLICK;
        MutabilityOwnership.m3745m(illustItemViewHolder, "this$0");
        MutabilityOwnership.m3745m(pixivIllust, "$illust");
        MutabilityOwnership.m3745m(obj, "$item");
        if (kVar != null) {
            FirebaseEventLogger cVar2 = illustItemViewHolder.firebaseEventLogger;
            AnalyticsScreenName cVar3 = kVar.f15598a;
            int i = kVar.f15599b;
            long j = pixivIllust.f19079id;
            MutabilityOwnership.m3745m(cVar3, "screenName");
            C4721b.m3752b(i, "via");
            Bundle bundle = new Bundle();
            bundle.putString("click_name", "open_content");
            bundle.putString("screen_name", cVar3.f13816a);
            bundle.putString("item_id", String.valueOf(j));
            bundle.putString("via", C2066a.m8760a(i));
            cVar2.m6296f();
            Timber.f23100a.mo3528a("%s %s", jVar, String.valueOf(bundle));
            FirebaseAnalytics firebaseAnalytics = cVar2.f14642a;
            Objects.requireNonNull(jVar);
            firebaseAnalytics.f10008a.zzx("click", bundle);
        }
        C3114c b = C3114c.m6284b();
        IllustItem illustItem = (IllustItem) obj;
        List<PixivIllust> allIllustList = illustItem.getAllIllustList();
        int position = illustItem.getPosition();
        if (kVar == null) {
            cVar = null;
        } else {
            cVar = kVar.f15598a;
        }
        b.m6280f(new ShowIllustDetailWithViewPagerEvent(allIllustList, position, componentVia, cVar));
    }

    /* renamed from: bind$lambda-1 */
    public static final boolean m12321bind$lambda1(PixivIllust pixivIllust, View view) {
        MutabilityOwnership.m3745m(pixivIllust, "$illust");
        C3114c.m6284b().m6280f(new ShowWorkMenuOnLongClickEvent(pixivIllust, 0, false, 6, null));
        return true;
    }

    public static final int getLayoutRes() {
        return Companion.getLayoutRes();
    }

    @Override // p270jp.pxv.android.viewholder.BaseViewHolder
    public void bind(Object obj) {
        MutabilityOwnership.m3745m(obj, "item");
        super.bind(obj);
        if (obj instanceof IllustItem) {
            IllustItem illustItem = (IllustItem) obj;
            PixivIllust target = illustItem.getTarget();
            FirebaseScreenNameVia itemClickAnalytics = illustItem.getItemClickAnalytics();
            ComponentVia itemClickComponentVia = illustItem.getItemClickComponentVia();
            if (illustItem.getScreenName() != null) {
                AnalyticsScreenName screenName = illustItem.getScreenName();
                if (screenName != null) {
                    this.illustGridThumbnailView.setAnalyticsParameter(new AnalyticsParameter(screenName, itemClickComponentVia, 0, 4));
                } else {
                    throw new IllegalArgumentException("Required value was null.".toString());
                }
            }
            this.illustGridThumbnailView.setIgnoreMuted(illustItem.getIgnoreIsMuted());
            this.illustGridThumbnailView.setIllust(target);
            this.illustGridThumbnailView.setOnClickListener(new View.OnClickListener(this, target, obj, itemClickComponentVia) { // from class: jp.pxv.android.viewholder.f

                /* renamed from: b */
                public final /* synthetic */ IllustItemViewHolder f19755b;

                /* renamed from: c */
                public final /* synthetic */ PixivIllust f19756c;

                /* renamed from: d */
                public final /* synthetic */ Object f19757d;

                /* renamed from: e */
                public final /* synthetic */ ComponentVia f19758e;

                {
                    this.f19755b = r2;
                    this.f19756c = r3;
                    this.f19757d = r4;
                    this.f19758e = r5;
                }

                @Override // android.view.View.OnClickListener
                public final void onClick(View view) {
                    IllustItemViewHolder.m12320bind$lambda0(FirebaseScreenNameVia.this, this.f19755b, this.f19756c, this.f19757d, this.f19758e, view);
                }
            });
            this.illustGridThumbnailView.setOnLongClickListener(new View$OnLongClickListenerC1094n0(target, 1));
            this.illustGridThumbnailView.setImage(target.imageUrls.getSquareMedium());
            if (itemClickComponentVia != null) {
                this.pixivAnalytics.m6526d(new ImpListEvent.C3342a(target.f19079id, itemClickComponentVia, AnalyticsScreenName.ILLUST_DETAIL));
            }
        }
    }
}
